package org.example.diary.exceptions;

/**
 * 验证异常
 *
 * @author tanxi 2021-03-20
 */
public class ValidateException extends SystemException {

    protected ValidateException(SystemErrorCode errorCode) {
        super(errorCode);
    }

    protected ValidateException(int code, String message) {
        super(code, message);
    }

    /**
     * 抛出验证异常
     *
     * @param errorCode
     */
    public static void throwing(SystemErrorCode errorCode) {
        throw new ValidateException(errorCode);
    }

    /**
     * 抛出验证异常
     *
     * @param errorCode
     */
    public static void throwing(SystemErrorCode errorCode, String message) {
        throw new ValidateException(errorCode.getCode(), message);
    }
}
